home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 19.zip
/
BS1 part 19
/
how to learn assembler.adf
/
CH4
/
4_3_4Aascii-dec.asm
< prev
next >
Wrap
Assembly Source File
|
1988-02-25
|
803b
|
29 lines
;(4.3.4A) ascii-dec
decin:
clr.l d1 ; First erase D1
move.l #string,a0 ; The string we want to convert
jsr decinloop ; Test subroutine
nop ; Breakpoint here
decinloop:
bsr digitin ; Convert digit
cmp #10,d0 ; Test, if valid
bcc decinok ; No, then done
mulu #10,d1 ; Shift result
add d0,d1 ; Insert nibble
bra decinloop ; And continue
decinok:
rts ; End of conversion
digitin: ; Converting the nibble from (A0)
clr.l d0 ; Erase D0
move.b (a0)+,d0 ; Get digit, increment A0
sub #'0',d0 ; Subtract $30
rts
string: dc.b '123456' ; The ASCII decimal string we want to convert
end